// 检验手机号码
export let patternMobile = /^(1[3-9])\d{9}$/i;
export let isMobile = (value) => {
	return patternMobile.test(value);
};

// 检验短信
export let isSMs = (value, leng = 6) => {
	if (leng == 6) {
		return /^\d{6}$/.test(value);
	} else if (leng == 4) {
		return /^\d{4}$/.test(value);
	}
};

// 校验邮箱
export let patternEmail =
  /^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?$/;
export let isEmail = (value) => {
	return patternEmail.test(value);
};

// 校验密码(数字,字母，特殊字符，任意2种组合)
export let patternPassword =
  /(?=.*\d)(?=.*[a-zA-Z\W])|(?=.*[a-zA-Z])(?=.*[\d\W])|(?=.*\W)(?=.*[a-zA-Z0-9]).{6,16}/;
export let isPassword = (value) => patternPassword.test(value);

// 非纯数字
export let patternNonNumber = /\D+/g;
// 非数字替换为空
export let noNumberToNull = (value) => value.replace(patternNonNumber, '');
